<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .vid {
            width: 800px;
            margin: 100px auto;
        }
    </style>

</head>

<body>
    <div class="vid">
        <!-- autoplay 自动播放 loop 循环播放 -->
        <video src="/pink/js_/高级js/画江湖/胡歌.mp4" controls width="800px" height="500px"></video>
    </div>
</body>
<script>
    let video = document.querySelector('video')

    function getjl(dataf, t) {
        let time = null
        return function () {
            if (!time) {
                time = setTimeout(function () {
                    dataf()
                    time = null
                }, t)
            }
        }
    }
    function date() {
        // console.log(parseInt(video.currentTime));
        localStorage.setItem('time', video.currentTime)
    }
    video.addEventListener('timeupdate', getjl(date, 1000))
    function updattime() {
        video.currentTime = localStorage.getItem('time')||0
    }
    video.addEventListener('loadeddata', updattime)
</script>

</html>